package com.atguigu.flyweight;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

// 网站工厂
public class WebSiteFactory {


    // 池
    private Map<String, ConcreteWebSite> pool = new ConcurrentHashMap<>();

    public WebSite getWebSiteCategory(String type) {
        if (!pool.containsKey(type)) {
            pool.put(type, new ConcreteWebSite(type));
        }

        return pool.get(type);
    }

    public int getWebSiteCount() {
		return pool.size();
	}
}
